<template>
	<view>
		<view class="test-statistical">
			<view class="statistical-box">
				<a-row>
				</a-row>
				<a-row>
					<a-typography-text style="color: #2a91fd;">
						试卷提交
					</a-typography-text>
				</a-row>
				<a-divider style="margin:0px;background-color: #2a91fd;"></a-divider>

				<a-row>
					<a-col :span="12">
						<a-row v-for="(item,index) in infolist">
							<a-col :span="24">
								<a-typography-text>
									{{item[0]}}:
								</a-typography-text>
								<a-typography-text style="margin-left: 18rpx">
									<template v-if="item[1]!='gender'">
										<div class="card-box ant-card-bordered">
											{{userinfo[item[1]]}}
										</div>
									</template>
									<template v-else>
										<div class="card-box ant-card-bordered">
											{{genderText[userinfo[item[1]]]}}
										</div>
									</template>
								</a-typography-text>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="24">
								<a-typography-paragraph>
									总共:<a-typography-text strong style="color:#000000">{{allSize}}
									</a-typography-text> 道</a-typography-paragraph>
							</a-col>
							<a-col :span="24">
								<a-typography-paragraph>
									正确:<a-typography-text type="success" strong style="font-size: 42rpx;color:#3f77fa">
										{{rightNum}}
									</a-typography-text> 道</a-typography-paragraph>
							</a-col>
							<a-col :span="24">
								<a-typography-paragraph>
									错误:<a-typography-text type="warning" strong style="font-size: 42rpx;color:#f33333">
										{{errorNum}}
									</a-typography-text> 道</a-typography-paragraph>
							</a-col>
							<a-col :span="24">
								<a-typography-paragraph>
									未作:<a-typography-text type="warning" strong style="font-size: 42rpx;color:#000">
										{{allSize-rightNum-errorNum}}
									</a-typography-text> 道</a-typography-paragraph>
							</a-col>
						</a-row>
					</a-col>
					<a-col :span="12">
						<a-row type="flex">
							<a-col>
								<a-typography-paragraph>
									<a-typography-title :level="2">
										{{score >= maxscore ? '恭喜你成绩及格':'很遗憾，成绩不及格！'}}
									</a-typography-title>
									<a-typography-title :level="2">
										本次成绩{{score}}分
									</a-typography-title>
								</a-typography-paragraph>
							</a-col>
						</a-row>
					</a-col>
				</a-row>

				<a-row style="margin-top: 88px;" class="close-panel" :justify="'center'" type="flex" :gutter="[8,4]">
					<a-col :span="7">
						<a-button block @click="$topage('/pages/exercise/errorlist', {}, 'close')">
							查看错题
						</a-button>
					</a-col>

					<!-- 	<a-col :span="7">
						<a-button type="primary" block
							@click="()=>{$refs.testController.resetAll();showStatistical=false}">重新开始</a-button>
					</a-col> -->

					<a-col :span="7">
						<a-button block @click="back">
							退出考试
						</a-button>
					</a-col>
				</a-row>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				infolist: [
					['姓名', 'studentName'],
					['性别', 'gender'],
					['科目', 'subject'],
					['车型', 'drive']
				],
				genderText: {
					0: '未知',
					1: '男',
					2: '女'
				},
				rightNum: 0,
				errorNum: 0,
				score: 0,
				maxscore: 0
			}
		},
		onLoad() {
		
			const qinfo = uni.getStorageSync('mocktestinfo')
			this.errorNum = qinfo.en
			this.rightNum = qinfo.rn
			this.allSize = qinfo.q.length
			this.score = qinfo.score
			this.maxscore = qinfo.maxscore
			this.userinfo = uni.getStorageSync('testpage')
			
			console.log('及格分数',this.maxscore)
				console.log('及格分数',this.score > this.maxscore)
		},
		methods: {
			back() {
				uni.redirectTo({
					url: '/pages/exercise/exercise'
				})
			},
		}
	}
</script>

<style>
	.test-statistical {
		height: 100%;
		width: 100%;
		position: fixed;
		padding-left: 10%;
		padding-right: 10%;
		z-index: 120;
	}

	.statistical-box {
		position: relative;
		width: 65%;
		height: 65%;
		padding: 12rpx;
		background-color: #fff;
		border-radius: 12rpx;
		margin: auto auto;
		border: 2rpx solid #1890ff;
	}


	.test-statistical-jiangjie {
		height: 100%;
		width: 100%;
		position: fixed;
		padding-left: 10%;
		padding-right: 10%;
		z-index: 120;
		display: flex;
		justify-content: center;
	}

	.statistical-box-jiangjie {
		position: relative;
		width: 65%;
		height: 65%;
		padding: 12rpx;
		background-color: #3578e1;
		border-radius: 12rpx;
		font-size: 42rpx;
		color: blue;
		margin: auto auto;
		backdrop-filter: blue;
		border: 2rpx solid #1890ff;
	}


	.closeBtn {
		top: 0;
		position: absolute;
		right: 0;
	}
</style>
